//
//  RegisterView.m
//  Car
//
//  Created by apple on 15/9/22.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "RegisterView.h"

#define kTextHeiht self.userPhoneNumber.frame.size.height

@implementation RegisterView


- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self setUpAttribute];
        
    }

    return self;
    
}


- (void)setUpAttribute {
    
    self.userPhoneNumber = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, kWidth, 44)];
    self.userPhoneNumber.placeholder = @"   请输入手机号";
    //  弹出数字键盘
    self.userPhoneNumber.keyboardType = UIKeyboardTypeNumberPad;
    [self setWithTextfield:self.userPhoneNumber];
    
    self.userName = [[UITextField alloc] initWithFrame:CGRectMake(0, 44, kWidth, self.userPhoneNumber.frame.size.height)];
    self.userName.placeholder = @"   请输入用户名";
    [self setWithTextfield:self.userName];
    
    self.userPassword = [[UITextField alloc] initWithFrame:CGRectMake(0, 44 * 2, kWidth, kTextHeiht)];
    self.userPassword.placeholder = @"   请输入密码(6-16个字符)";
    //  密文
    self.userPassword.secureTextEntry = YES;
    [self setWithTextfield:self.userPassword];
    
    
    
    self.userPasswordAgain = [[UITextField alloc] initWithFrame:CGRectMake(0, 44 * 3, kWidth, kTextHeiht)];
    self.userPasswordAgain.placeholder = @"   确认密码";
    //  密文输入
    self.userPasswordAgain.secureTextEntry = YES;
    [self setWithTextfield:self.userPasswordAgain];
    
    
    self.identifyWord = [[UITextField alloc] initWithFrame:CGRectMake(0, 44 * 4, kWidth, kTextHeiht)];
    self.identifyWord.placeholder = @"   请输入验证码";
    [self setWithTextfield:self.identifyWord];
    
    self.registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.registerButton.frame = CGRectMake(40, 44 * 5 + 30, kWidth - 80, 38);
    [self.registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [self.registerButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.registerButton.backgroundColor = [UIColor colorWithRed:51/255.0f green:161/255.0f blue:201/255.0f alpha:1.0];
    //  圆角
    self.registerButton.layer.masksToBounds = YES;
    self.registerButton.layer.cornerRadius = 5;
    
    //  获取验证码按钮
    self.actionGetIdentifyWord = [UIButton buttonWithType:UIButtonTypeSystem];
    self.actionGetIdentifyWord.frame = CGRectMake(kWidth - 140, 44 * 4, 140, kTextHeiht);
    [self.actionGetIdentifyWord setTitle:@"点击发送验证码" forState:UIControlStateNormal];
    [self.actionGetIdentifyWord setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    self.actionGetIdentifyWord.titleLabel.font = [UIFont fontWithName:@"CourierNewPS-BoldMT" size:15];
    
    [self addSubview:self.registerButton];
    [self addSubview:self.userPhoneNumber];
    [self addSubview:self.userName];
    [self addSubview:self.userPassword];
    [self addSubview:self.userPasswordAgain];
    [self addSubview:self.identifyWord];
    [self addSubview:self.actionGetIdentifyWord];

    
    
    
}





- (void)setWithTextfield:(UITextField *)textfield {
    
    //  边框
    textfield.layer.borderWidth = 1;
    textfield.layer.borderColor = [[UIColor colorWithWhite:0.8 alpha:0.6] CGColor];
    //  清除按钮
    textfield.clearButtonMode = UITextFieldViewModeWhileEditing;
    
    
    
}



    
    






@end
